<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <img src="./images/1.webp">
    <script>
        //1.获取对象元素
        let pic=document.querySelector('img')
        //2.得到随机数
        function getRandom(min,max){
            return (Math.floor(Math.random()*(max-min+1))+min)
        }
        let id=getRandom(1,6)
        //3.更改元素的属性
        pic.src=`./images/${id}.webp`
    </script>
</body>
</html>